<?php

namespace addons\sum\controller;


use addons\sum\controller\Base;

class Richtext extends Base
{

    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    // 富文本 列表
    public function index()
    {
        $search=$this->request->get('search');
        $type=$this->request->get('type');
        $map=[];
        if($search){
            $map['title'] = ['like', '%'.$search.'%'];
        }
        if($type){
            $map['type'] =$type;
        }
        $this->success('获取成功', \addons\sum\model\Richtext::where($map)->order('id', 'DESC')->paginate(10));
    }
    public function detail() {
        $id = $this->request->get('id');
        $map=[];
        if($id){
            $map['id']=$id;
        }
        $slug = $this->request->get('slug');
        if($slug){
            $map['slug']=$slug;
        }
        $data = \addons\sum\model\Richtext::where($map)->find();
        $this->success($data->title??'操作成功', $data);
    }

}
